home *** CD-ROM | disk | FTP | other *** search
/ Loadstar Extras 3 / Ex3side2.d64 / loader src.sda / LOADER.SRC < prev    next >
Text File  |  2022-08-28  |  21KB  |  2,076 lines

  1. ;*** LOADER
  2.  
  3. open =$ffc0
  4. cint =$ff81
  5. readst =$ffb7
  6. setlfs =$ffba
  7. setnam =$ffbd
  8. setmsg =$ff90
  9. load =$ffd5
  10. getin =$ffe4
  11. input'buffer =512
  12. clrchn =$ffcc
  13. close =$ffc3   ;a
  14. chrin =$ffcf
  15. chkout =$ffc9  ;x
  16. chkin =$ffc6   ;x
  17. plot =$fff0
  18. chrout =$ffd2
  19. color'pointer =243
  20. screen'line'pointer =209
  21. print'number =$bdcd ;x,a
  22. clear'line =59903
  23. background =53281
  24. border =53280
  25. strout = $ab1e; .A low .Y high
  26. unlisten =$ffae
  27. clall =$ffe7
  28. color1 =53282
  29. color2 =53283
  30. color3 =53284
  31. white =5
  32. crsr'down =17
  33. rvs'on =18
  34. home =19
  35. del =20
  36. red =28
  37. crsr'right =29
  38. green =30
  39. blue =31
  40. black =144
  41. lowercase =14
  42. uppercase =142
  43. crsr'up =145
  44. rvs'off =146
  45. clr =147
  46. insert =148
  47. brown =149
  48. light'red =150
  49. dark'grey =151
  50. medium'grey =152
  51. light'green =153
  52. light'blue =154
  53. light'grey =155
  54. purple =156
  55. crsr'left =157
  56. yellow =158
  57. cyan =159
  58. top'left =176
  59. top'right =174
  60. bottom'left =173
  61. bottom'right =189
  62. .org $0801
  63.  
  64. .obj "@0:loader"
  65. ;mem
  66.  
  67. .byte $0b,$08,$0a,$00,$9e,$32,$30,$36
  68. .byte $31,$00,$00,$00
  69.  
  70.  
  71. lda #8
  72. jsr chrout
  73. lda #4
  74. sta 648
  75. jsr cint
  76. lda 56578
  77. ora #3
  78. sta 56578
  79. lda 56576
  80. and #252
  81. ora #3
  82.  
  83. sta 56576
  84.  
  85. lda #27
  86. sta 53265
  87.  
  88. lda 53270
  89. and #239
  90. sta 53270
  91. lda #0
  92. sta 53281
  93. ldx #0
  94. - stx 53280
  95. inx
  96. bne -
  97. stx 53280
  98.  
  99.  
  100. lda #119
  101. sta 787
  102. lda #0
  103. sta partition'mode
  104.  
  105. artstay lda 186
  106. cmp #8
  107. bcs +
  108. lda #8
  109. + cmp #30
  110. bcc +
  111. lda #8
  112. + sta device
  113. sta boot'device
  114. jsr poll'devices
  115. lda boot'device
  116. sta 186
  117. lda 787
  118. cmp #119
  119. beq ++
  120.  
  121. device'crap ldx boot'device
  122. lda devices,x
  123. beq +
  124. jsr find'device
  125. jsr make'screen
  126. lda devices
  127. cmp #2
  128. bcc +
  129. lda #255
  130. sta partition'mode
  131. jsr device'menu
  132.  
  133. reentry =*
  134.  
  135. + lda #0
  136. sta n'files
  137. sta n'files+1
  138. + jsr get'files
  139. lda init'results
  140. bne device'crap
  141.  
  142. lda n'files
  143. ora n'files+1
  144. bne +
  145.  
  146. ldx <nothing'prompt
  147. ldy >nothing'prompt
  148. jsr do'message
  149.  
  150. lda #0
  151. sta 198
  152.  
  153. - jsr getin
  154. beq -
  155. jmp device'crap
  156.  
  157. + jmp file'menu
  158. rts
  159.  
  160. get'files lda #0
  161. sta init'results
  162. sta 787
  163. lda partition'mode
  164. beq +
  165. jmp get'partitions
  166. + lda #15
  167. jsr close
  168. lda #1
  169. ldx <init
  170. ldy >init
  171. jsr setnam
  172. lda #15
  173. ldx device
  174. ldy #15
  175. jsr setlfs
  176. jsr open
  177.  
  178. jsr clrchn
  179. ldx #15
  180. jsr chkin
  181. ldy #0
  182. - jsr getin
  183. cmp #13
  184. beq +
  185. sta error'buffer,y
  186. iny
  187. bne -
  188. + lda #0
  189. sta error'buffer,y
  190. jsr clrchn
  191.  
  192. lda error'buffer
  193. ora error'buffer+1
  194. cmp "0"
  195. beq +
  196. error'init ldx <error'buffer
  197. ldy >error'buffer
  198. jsr do'message
  199.  
  200. lda #15
  201. jsr close
  202.  
  203. lda #0
  204. sta 198
  205. sta n'files
  206. - jsr getin
  207. beq -
  208.  
  209. rts
  210.  
  211. + lda #34
  212. ldx <dir'name
  213. ldy >dir'name
  214. jsr setnam
  215. lda #2
  216. ldx device
  217. ldy #0
  218. jsr setlfs
  219. jsr open
  220. jsr clrchn
  221. ldx #2
  222. jsr chkin
  223.  
  224. ldx <$d000
  225. stx 251
  226. ldy >$d000
  227. sty 252
  228. ldy #0
  229. jsr getin
  230. jsr getin
  231. - ldy #0
  232. jsr getin
  233. jsr rom'out
  234. sta (251),y
  235. jsr rom'in
  236. jsr bump'251
  237. jsr readst
  238. and #66
  239. sta eof
  240. beq -
  241.  
  242. lda #2
  243. jsr close
  244. jsr clrchn
  245. ldy #0
  246. tya
  247. jsr rom'out
  248. sta (251),y
  249. jsr rom'in
  250.  
  251. lda 251
  252. sec
  253. sbc <$d000
  254. sta n'files
  255. lda 252
  256. sbc >$d000
  257. sta n'files+1
  258.  
  259. ldx #4
  260. -  lsr n'files+1
  261. ror n'files
  262. dex
  263. bpl -
  264.  
  265. lda n'files
  266. sec
  267. sbc #1
  268. sta n'files
  269. lda n'files+1
  270. sbc #0
  271. sta n'files+1
  272. rts
  273.  
  274. get'partitions jsr wipe'mem
  275. lda #255
  276. sta partition'mode
  277. lda #15
  278. jsr close
  279. lda #1
  280. ldx <init
  281. ldy >init
  282. jsr setnam
  283. lda #15
  284. ldx device
  285. ldy #15
  286. jsr setlfs
  287. jsr open
  288. jsr clrchn
  289. ldx #15
  290. jsr chkin
  291. ldy #0
  292. - jsr getin
  293. cmp #13
  294. beq +
  295. sta error'buffer,y
  296. iny
  297. bne -
  298. + lda #0
  299. sta error'buffer,y
  300. jsr clrchn
  301.  
  302. lda error'buffer
  303. ora error'buffer+1
  304. cmp "0"
  305. beq +
  306. lda #255
  307. sta init'results
  308.  
  309. jmp error'init
  310.  
  311. + lda #15
  312. jsr close
  313. lda #2
  314. ldx <pinit
  315. ldy >pinit
  316. jsr setnam
  317. lda #15
  318. ldx device
  319. ldy #15
  320. jsr setlfs
  321. jsr open
  322. jsr clrchn
  323. ldx #15
  324. jsr chkin
  325. ldy #0
  326. - jsr getin
  327. cmp #13
  328. beq +
  329. sta error'buffer,y
  330. iny
  331. bne -
  332. + lda #0
  333. sta error'buffer,y
  334. jsr clrchn
  335.  
  336. lda error'buffer
  337. cmp "0"
  338. bne +
  339. lda error'buffer+1
  340. cmp "2"
  341. bne +
  342. jmp ++
  343.  
  344. + lda #0
  345. sta partition'mode
  346. jmp get'files
  347.  
  348. + jsr clrchn
  349. ldx <part'mess
  350. ldy >part'mess
  351. jsr do'message
  352.  
  353. lda #3
  354. ldx <part'dir'name
  355. ldy >part'dir'name
  356. jsr setnam
  357. lda #2
  358. ldx device
  359. ldy #0
  360. jsr setlfs
  361. jsr open
  362. jsr clrchn
  363.  
  364. ldx #15
  365. jsr chkin
  366. ldy #0
  367. - jsr getin
  368. cmp #13
  369. beq +
  370. sta error'buffer,y
  371. iny
  372. bne -
  373. + lda #0
  374. sta error'buffer,y
  375. jsr clrchn
  376.  
  377. lda error'buffer
  378. ora error'buffer+1
  379. cmp "0"
  380. beq +
  381. lda #0
  382. sta partition'mode
  383. jmp get'files
  384.  
  385. + jsr clrchn
  386. ldx #2
  387. jsr chkin
  388.  
  389. ldx <$d000-32
  390. stx 251
  391. ldy >$d000-32
  392. sty 252
  393. ldy #0
  394. jsr getin
  395. jsr getin
  396. - ldy #0
  397. jsr getin
  398. jsr rom'out
  399. sta (251),y
  400. jsr rom'in
  401. jsr bump'251
  402. jsr readst
  403. and #66
  404. sta eof
  405. beq -
  406.  
  407. lda #2
  408. jsr close
  409. jsr clrchn
  410. ldy #0
  411. tya
  412. jsr rom'out
  413. sta (251),y
  414. jsr rom'in
  415.  
  416. lda 251
  417. sec
  418. sbc <40960-32
  419. sta n'files
  420. lda 252
  421. sbc >40960-32
  422. sta n'files+1
  423.  
  424. ldx #4
  425. -  lsr n'files+1
  426. ror n'files
  427. dex
  428. bpl -
  429.  
  430. lda n'files
  431. sec
  432. sbc #2
  433. sta n'files
  434. lda n'files+1
  435. sbc #0
  436. sta n'files+1
  437.  
  438. lda n'files+1
  439. bne +
  440. lda n'files
  441. cmp #2
  442. bcs +
  443. lda #0
  444. sta n'files
  445. sta n'files+1
  446. lda #0
  447. sta partition'mode
  448. jmp get'files
  449. + rts
  450.  
  451. ;ldx n'files
  452. ;lda n'files+1
  453. ;jmp $bdcd
  454.  
  455. index'file lda file
  456. sta 253
  457. lda file+1
  458. sta 254
  459.  
  460. ldx #4
  461. - asl 253
  462. rol 254
  463. dex
  464. bpl -
  465.  
  466. lda <$d000
  467. clc
  468. adc 253
  469. sta 253
  470. lda >$d000
  471. adc 254
  472. sta 254
  473.  
  474.  
  475. ldy #31
  476. jsr rom'out
  477. - lda (253),y
  478. sta file'buffer,y
  479. dey
  480. bpl -
  481.  
  482. jmp rom'in
  483.  
  484. print'file ldx file'buffer
  485. lda file'buffer+1
  486. jsr print'number
  487.  
  488. ldy #2
  489. - lda file'buffer,y
  490. jsr chrout
  491. iny
  492. cmp #34
  493. bne -
  494.  
  495. sty typeloc
  496. lda file'buffer,y
  497. cmp "h"
  498. beq +
  499. iny
  500. iny
  501.  
  502. / lda file'buffer,y
  503. jsr chrout
  504. cmp #34
  505. beq dotype
  506. iny
  507. bne -
  508.  
  509. dotype lda #25
  510. sta 211
  511. jsr 58732
  512. ldy typeloc
  513. lda file'buffer,y
  514.  
  515. cmp "r"
  516. beq it'syum
  517.  
  518. cmp "h"
  519. beq it'sconnect
  520.  
  521. cmp "b"
  522. beq it'sboot
  523.  
  524. cmp "t"
  525. beq it'stext
  526.  
  527. cmp "p"
  528. beq it'spacked
  529.  
  530.  
  531. it'syum lda <rtype
  532. ldy >rtype
  533. jmp strout
  534.  
  535. it'sconnect lda <htype
  536. ldy >htype
  537. jmp strout
  538.  
  539.  
  540. it'sboot lda <btype
  541. ldy >btype
  542. jmp strout
  543.  
  544. it'stext lda <ttype
  545. ldy >ttype
  546. jmp strout
  547.  
  548.  
  549. it'spacked lda <ptype
  550. ldy >ptype
  551. jmp strout
  552.  
  553. print'part ldx file'buffer
  554. lda file'buffer+1
  555. jsr print'number
  556.  
  557. ldy #2
  558. - lda file'buffer,y
  559. jsr chrout
  560. iny
  561. cpy #32
  562. bne -
  563. rts
  564.  
  565. make'screen lda #26
  566. sta 53272
  567. lda #0
  568. sta 53281
  569. lda #6
  570. sta 53280
  571.  
  572. ldx <frame1
  573. ldy >frame1
  574. jsr do'frame
  575.  
  576. ldx <box1
  577. ldy >box1
  578. jsr do'box
  579.  
  580. ldx <box2
  581. ldy >box2
  582. jsr do'box
  583.  
  584. ldx <box3
  585. ldy >box3
  586. jsr do'box
  587.  
  588. ldx <box4
  589. ldy >box4
  590. jsr do'box
  591.  
  592. ldx <box5
  593. ldy >box5
  594. jsr do'box
  595.  
  596. ldx <box6
  597. ldy >box6
  598. jsr do'box
  599.  
  600. ldx <frame2
  601. ldy >frame2
  602. jsr do'frame
  603.  
  604. ldx <box7
  605. ldy >box7
  606. lda #96
  607. sta box7+4
  608. lda #5
  609. sta box7+5
  610. jsr do'box
  611. jsr fade'in
  612.  
  613. ldx <box7
  614. ldy >box7
  615. lda #95
  616. sta box7+4
  617. lda #3
  618. sta box7+5
  619. jsr do'box
  620.  
  621. ldx <box8
  622. ldy >box8
  623. jsr do'box
  624.  
  625. optimize sta 53374 ;way doown here to
  626. sta 53366;give the vic chip time after
  627. sta 53375; changing font
  628.  
  629. lda frame1+4
  630. sta 646
  631. lda #0
  632. sta 199
  633.  
  634. ldy #0
  635. ldx #2
  636. clc
  637. jsr plot
  638.  
  639. lda #171
  640. jsr chrout
  641.  
  642. ldy #39
  643. ldx #2
  644. clc
  645. jsr plot
  646.  
  647. lda #179
  648. jsr chrout
  649.  
  650. jsr linx
  651.  
  652. ldy #0
  653. ldx #22
  654. clc
  655. jsr plot
  656.  
  657. lda #171
  658. jsr chrout
  659.  
  660. ldy #39
  661. ldx #22
  662. clc
  663. jsr plot
  664.  
  665. lda #179
  666. jsr chrout
  667. jsr linx
  668. lda #19
  669. jsr chrout
  670.  
  671. ;ldy #0
  672. ;- lda info,y
  673. ;beq +
  674. ;ora #128
  675. ;sta 1947,y
  676. ;iny
  677. ;bne -
  678.  
  679. ldy #0
  680. - lda info2,y
  681. beq +
  682. ora #128
  683. sta 1024+40+3,y
  684. iny
  685. bne -
  686.  
  687. + rts
  688.  
  689. poll'devices lda #0
  690. sta devices
  691. lda #8
  692. sta temp
  693. - lda temp
  694. tax
  695. cmp #14
  696. beq +
  697. lda #0
  698. sta devices,x
  699.  
  700. lda #0
  701. tax
  702. tay
  703. jsr setnam
  704. lda #2
  705. ldx temp
  706. tay
  707. jsr setlfs
  708. jsr open
  709. lda #2
  710. jsr close
  711. jsr readst
  712. bmi +
  713. ldx temp
  714. txa
  715. sta devices,x
  716. inc devices
  717.  
  718. + inc temp
  719. lda temp
  720. cmp #30
  721. bcc -
  722. rts
  723.  
  724. fade'out lda #255
  725. ldy #7
  726. - sta 96*8+font,y
  727. dey
  728. bpl -
  729.  
  730. ldx #63
  731.  
  732. lda <fade'data
  733. sta 251
  734. lda >fade'data
  735. sta 252
  736.  
  737. - ldy #7
  738. - lda (251),y
  739. sta shift'space,y
  740. dey
  741. bpl -
  742.  
  743. lda #8
  744. clc
  745. adc 251
  746. sta 251
  747. lda #0
  748. adc 252
  749. sta 252
  750. dex
  751. bpl --
  752. rts
  753.  
  754. fade'in lda #0
  755. ldy #7
  756. - sta 96*8+font,y
  757. dey
  758. bpl -
  759.  
  760. ldx #64
  761.  
  762. lda <64*8+fade'data
  763. sta 251
  764. lda >64*8+fade'data
  765. sta 252
  766.  
  767. - ldy #7
  768. - lda (251),y
  769. sta shift'space,y
  770. dey
  771. bpl -
  772.  
  773. - lda 53265
  774. bpl -
  775.  
  776. lda 251
  777. sec
  778. sbc #8
  779. sta 251
  780. lda 252
  781. sbc #0
  782. sta 252
  783. dex
  784. bpl ---
  785. rts
  786.  
  787. find'device inx
  788. - lda devices,x
  789. bne +
  790. inx
  791. cpx #31
  792. bne -
  793. ldx #8
  794. + stx device
  795. rts
  796.  
  797. device'menu lda #4
  798. sta parms
  799. lda #9
  800. sta parms+1
  801. lda #5
  802. sta parms+2
  803. lda #8
  804. clc
  805. adc devices
  806. sta parms+3
  807. lda #255
  808. sta parms+4
  809. lda #5
  810. sta parms+5
  811. ldx <parms
  812. ldy >parms
  813. jsr do'box
  814.  
  815. inc parms
  816. inc parms+1
  817. dec parms+2
  818. dec parms+3
  819. lda #7
  820. sta parms+4
  821. ldx <parms
  822. ldy >parms
  823. jsr do'frame
  824.  
  825. inc parms
  826. dec parms+1
  827. inc parms+2
  828. dec parms+3
  829. lda #96
  830. sta parms+4
  831. lda #3
  832. sta parms+5
  833. ldx <parms
  834. ldy >parms
  835. jsr do'box
  836. jsr fade'in
  837. lda #160
  838. sta parms+4
  839. ldx <parms
  840. ldy >parms
  841. jsr do'box
  842.  
  843. print'devices lda parms+5
  844. sta 646
  845. lda #1
  846. sta 199
  847. ldy parms
  848. iny
  849. ldx parms+2
  850. inx
  851. clc
  852. jsr plot
  853.  
  854. ldx #8
  855. ldy #0
  856. - lda devices,x
  857. bne +
  858. inx
  859. cpx #30
  860. bcc -
  861. jmp ++
  862.  
  863. + cpx #10
  864. bcs no0
  865. lda "0"
  866. jsr chrout
  867. no0 txa
  868. sta device'array,y
  869. iny
  870. sty temp
  871. pha
  872. lda #0
  873. jsr print'number
  874.  
  875. ldx 214
  876. inx
  877. ldy parms
  878. iny
  879. c